package com.atguigu.gmall.order.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.order.entity.OrderInfo;
import com.atguigu.gmall.model.order.vo.OrderConfirmVo;
import com.atguigu.gmall.order.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/inner/order")
public class OrderRpcController {

    @Autowired
    OrderInfoService orderInfoService;

    /**
     * 获取订单页数据
     * @return
     */
    @GetMapping("/getOrderConfirmVo")
    public Result<OrderConfirmVo> getOrderConfirmVo() {
        OrderConfirmVo
                orderConfirmVo = orderInfoService.getOrderConfirmVo();
        return Result.ok(orderConfirmVo);
    }

    /**
     * 获取订单详情
     * @param orderId
     * @return
     */
    @GetMapping("/getOrderInfo/{orderId}")
    public Result<OrderInfo> getOrderInfo(@PathVariable Long orderId) {
        OrderInfo orderInfo = orderInfoService.getOrderInfo(orderId);
        return Result.ok(orderInfo);
    }
}
